package com.xkdx.guangguang.presistence.uploaddevicetoken;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import android.content.Context;
import android.telephony.TelephonyManager;

import com.xkdx.guangguang.module.network.AbsAction;
import com.xkdx.guangguang.module.network.AbsAction.Parameter;

public class UpLoadDeviceTokenAction extends AbsAction {
	Context context;
	String updateTime;
	public UpLoadDeviceTokenAction(Context context,String updateTime) {
		this.context = context;
		this.updateTime=updateTime;
	}

	@Override
	public void constructRequest() {
		TelephonyManager mTelephonyManager = (TelephonyManager) context
				.getSystemService(Context.TELEPHONY_SERVICE);
		
		HashMap<String, String> map = new HashMap<String, String>();
		map.put("DeviceToken", mTelephonyManager.getDeviceId()+"_1");
		
		String json = constructJson(map);
		Parameter parameter = new Parameter("pushInterface",
				"uploadANDROIDDeviceToken", json);
		List<Parameter> list = new ArrayList<Parameter>();
		list.add(parameter);
		
		HashMap<String, String> map1 = new HashMap<String, String>();
		map1.put("DeviceID", "2");
		map1.put("LastUpdateTime", updateTime);
		String json1 = constructJson(map1);
		Parameter parameter1 = new Parameter("brandInterface", "getUpdatedBrandList", json1);
		
		list.add(parameter1);
		
		requestData = constructMod(list);

	}

}
